﻿//--------------------------------------------------------------------------
// 
//  Copyright (c) Chili Software.  All rights reserved. 
// 
//  File: Token.cs
//
//  Description: A single token from a string.
// 
//--------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;

namespace Chili.Opf3.Query.OPathParser
{
	/// <summary>
	/// Represents a token returned by the <see cref="Tokenizer">Tokenizer</see> class.
	/// </summary>
	/// <remarks>
	/// This class represents a token that is returned by the <see cref="Tokenizer">Tokenizer</see>
	/// class during parsing of the OPath expression.
	/// </remarks>
	internal sealed class Token
	{
		private TokenKinds _tokenKind = TokenKinds.Unknown;
		private string _value;

		/// <summary>
		/// Creates a new instance of the <see cref="Token">Token Class</see>.
		/// </summary>
		/// <param name="tokenKind">Type of the token.</param>
		/// <param name="value">String representation of the token.</param>
		public Token(TokenKinds tokenKind, string value)
		{
			TokenKind = tokenKind;
			Value = value;
		}

		/// <summary>
		/// Returns the type of the token.
		/// </summary>
		/// <value>The type of the token.</value>
		public TokenKinds TokenKind
		{
			get { return _tokenKind; }
			private set { _tokenKind = value; }
		}

		/// <summary>
		/// Specifies the content of the token (the string representation of the token).
		/// </summary>
		/// <value>The content of the token.</value>
		public string Value
		{
			get { return _value; }
			set { _value = value; }
		}
	}
}
